/* File: poly.h Author: Katherine Gibson (gibsonk@seas) Desc: example of polymorphism using Animal and its child classes Cat, Dog, and Bird -- prototypes */ #ifndef POLY_H_ #define POLY_H_ #define DEF_VAL 0 #define DEF_STRING "" class Animal { public: // constructor Animal(string name = DEF_STRING); // functions void Eat(); void Speak(); void Perform(); // variables string m_name; } ; class Bird: public Animal { public: // constructor Bird(string name = DEF_STRING); //functions void Eat(); void Speak(); void Perform(); } ; class Cat: public Animal { public: // constructor Cat(string name = DEF_STRING); //functions void Eat(); void Speak(); void Perform(); } ; class Dog: public Animal { public: // constructor Dog(string name = DEF_STRING); //functions void Eat(); void Speak(); void Perform(); } ; #endif /* POLY_H_ */